﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using Assist;
using Autodesk.Revit.UI;
using YJKDataLookAfter;
using YArchitech.LIB.YJKControls;
using YJKDataBase;

namespace YJKArchiFormat
{
	public partial class DlgMain : Form, IDlgBase
	{
		public static DlgMain GetInstance(UIApplication app)
		{
			if (DlgMain.main == null || DlgMain.main.IsDisposed)
			{
				DlgMain.main = new DlgMain(app);
			}
			return DlgMain.main;
		}

		public TreeView TrCategory
		{
			get
			{
				return this.trCategory;
			}
		}

		public ListView LvFamily
		{
			get
			{
				return this.lvFamily;
			}
		}

		public void WhenSubjectChange()
		{
			if (this.currentSubject != null)
			{
				this.searchDb = this.CurrentSubject.Database;
				this.tsmiAddFamily.Enabled = false;
				this.btnAddCategory.Enabled = true;
				this.btnDelCategory.Enabled = false;
				this.btnAddFamily.Enabled = false;
				this.btnDelFamily.Enabled = false;
				this.btnEditCategory.Enabled = false;
				this.btnEditFamily.Enabled = false;
				this.outputToolStripMenuItem.Enabled = true;
				this.toolStripStatusLabel1.Text = this.CurrentSubject.Name + "-";
			}
		}

		public void WhenCategoryChange()
		{
			if (this.currentCategory != null)
			{
				try
				{
					this.lvFamily.Items.Clear();
					this.lvFamily.LargeImageList.Images.Clear();
					this.lvFamily.SmallImageList.Images.Clear();
					this.btnDelCategory.Enabled = true;
					this.btnAddFamily.Enabled = true;
					new List<DbStandardRoom>();
					List<DbStandardRoom> allRoom = new StandardRoomCategory(this.currentCategory).GetAllRoom();
					this.lvFamily.BeginUpdate();
					foreach (DbStandardRoom dbStandardRoom in allRoom)
					{
						this.lvFamily.LargeImageList.Images.Add(dbStandardRoom.DbObject.Name, dbStandardRoom.DbObject.Image);
						this.lvFamily.SmallImageList.Images.Add(dbStandardRoom.DbObject.Name, dbStandardRoom.DbObject.Image);
						ListViewItem listViewItem = new ListViewItem();
						listViewItem.Text = dbStandardRoom.DbObject.Name;
						listViewItem.Tag = dbStandardRoom.DbObject;
						listViewItem.ImageKey = dbStandardRoom.DbObject.Name;
						ListViewItem.ListViewSubItem listViewSubItem = new ListViewItem.ListViewSubItem();
						listViewSubItem.Text = dbStandardRoom.DbObject.Version;
						listViewItem.SubItems.Add(listViewSubItem);
						ListViewItem.ListViewSubItem listViewSubItem2 = new ListViewItem.ListViewSubItem();
						listViewSubItem2.Text = dbStandardRoom.DbObject.Date.ToString();
						listViewItem.SubItems.Add(listViewSubItem2);
						ListViewItem.ListViewSubItem listViewSubItem3 = new ListViewItem.ListViewSubItem();
						listViewSubItem3.Text = this.dbs[0].CategoryTable[dbStandardRoom.DbObject.ParentId].Name;
						listViewItem.SubItems.Add(listViewSubItem3);
						ListViewItem.ListViewSubItem listViewSubItem4 = new ListViewItem.ListViewSubItem();
						listViewSubItem4.Text = dbStandardRoom.DbObject.Description;
						listViewItem.SubItems.Add(listViewSubItem4);
						this.lvFamily.Items.Add(listViewItem);
					}
					this.lvFamily.EndUpdate();
					this.lvFamily.Focus();
					if (this.lvFamily.Items.Count > 0)
					{
						this.lvFamily.ContextMenuStrip = this.cmsFamily;
					}
					else
					{
						this.lvFamily.ContextMenuStrip = null;
					}
					return;
				}
				catch (Exception ex)
				{
					MessageBox.Show(ex.Message);
					return;
				}
			}
			this.btnAddFamily.Enabled = false;
			this.btnTop.Enabled = false;
			this.btnPrevious.Enabled = false;
			this.btnNext.Enabled = false;
			this.btnBottom.Enabled = false;
		}

		public void WhenFamilyChange()
		{
			if (this.CurrentObject == null)
			{
				this.btnDelFamily.Enabled = false;
				this.btnEditFamily.Enabled = false;
				this.btnDownload.Enabled = false;
				return;
			}
			DbCategory dbCategory = this.currentRoom.Database.CategoryTable[this.currentRoom.ParentId];
			this.searchDb = this.CurrentObject.Database;
			DbSubject dbSubject = this.currentRoom.Database.SubjectTable.AllSubject()[0];
			this.btnDelFamily.Enabled = true;
			this.btnEditFamily.Enabled = true;
			this.btnDownload.Enabled = true;
			this.ShowType();
			if (this.CurrentCategory == null)
			{
				this.toolStripStatusLabel1.Text = dbSubject + "-" + this.CurrentObject;
				return;
			}
			this.toolStripStatusLabel1.Text = string.Concat(new object[]
			{
				dbSubject.Name,
				"-",
				dbCategory.Name,
				"\\",
				this.CurrentObject
			});
		}

		public UIApplication UiApp
		{
			get
			{
				return this.m_uiApp;
			}
			set
			{
				this.m_uiApp = value;
			}
		}

		public DbSubject CurrentSubject
		{
			get
			{
				return this.currentSubject;
			}
			set
			{
				this.currentSubject = value;
				this.WhenSubjectChange();
			}
		}

		public DbCategory CurrentCategory
		{
			get
			{
				return this.currentCategory;
			}
			set
			{
				this.currentCategory = value;
				this.WhenCategoryChange();
			}
		}

		public YJKDataBase.DbObject CurrentObject
		{
			get
			{
				return this.currentRoom;
			}
			set
			{
				this.currentRoom = value;
				this.WhenFamilyChange();
			}
		}

		public DlgMain(UIApplication app)
		{
			this.m_uiApp = app;
			this.InitializeComponent();
			this.trCategory.AfterLabelEdit += this.trCategory_AfterLabelEdit;
			this.trCategory.ItemDrag += this.trFamilyTree_ItemDrag;
			this.lvFamily.ItemDrag += this.listView1_ItemDrag;
			this.lvFamily.DragEnter += this.listView1_DragEnter;
			this.lvFamily.AfterLabelEdit += this.listView1_AfterLabelEdit;
			this.trCategory.DragEnter += this.trFamilyTree_DragEnter;
			this.trCategory.DragOver += this.trFamilyTree_DragOver;
			this.trCategory.MouseClick += this.trFamilyTree_MouseClick;
			this.trCategory.DragDrop += this.trFamilyTree_DragDrop;
			this.trCategory.MouseDown += this.trFamilyTree_MouseDown;
		}

		private void FrmMain_Load(object sender, EventArgs e)
		{
			DbData dbData = ConfigUtils.ReadStandardRoomXmlFile("数据库类型");
			if (dbData is LocalDbData)
			{
				this.rbLocal.Checked = true;
				return;
			}
			if (dbData is ServerDbData)
			{
				this.rbServer.Checked = true;
			}
		}

		private void listView1_DragEnter(object sender, DragEventArgs e)
		{
			e.Effect = DragDropEffects.Move;
		}

		private void trFamilyTree_ItemDrag(object sender, ItemDragEventArgs e)
		{
			base.DoDragDrop(e.Item, DragDropEffects.Move);
		}

		private void listView1_ItemDrag(object sender, ItemDragEventArgs e)
		{
			if (this.lvFamily.SelectedItems.Count > 0)
			{
				this.lvFamily.DoDragDrop(this.lvFamily.SelectedItems[0], DragDropEffects.Copy | DragDropEffects.Move);
			}
		}

		private void trFamilyTree_DragEnter(object sender, DragEventArgs e)
		{
			if (e.Data.GetDataPresent(typeof(TreeNode)))
			{
				e.Effect = DragDropEffects.Move;
				return;
			}
			if ((ListViewItem)e.Data.GetData(typeof(ListViewItem)) != null)
			{
				e.Effect = DragDropEffects.Move;
				return;
			}
			this.Cursor = Cursors.No;
		}

		private void trFamilyTree_DragOver(object sender, DragEventArgs e)
		{
			this.Cursor = Cursors.Hand;
		}

		private void trFamilyTree_DragDrop(object sender, DragEventArgs e)
		{
			this.Cursor = Cursors.Default;
			System.Drawing.Point pt = ((TreeView)sender).PointToClient(new System.Drawing.Point(e.X, e.Y));
			TreeNode nodeAt = ((TreeView)sender).GetNodeAt(pt);
			if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false))
			{
				TreeNode treeNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode");
				if (nodeAt == treeNode)
				{
					return;
				}
				TreeNode treeNode2 = this.FindRoot(treeNode);
				TreeNode treeNode3 = this.FindRoot(nodeAt);
				if (treeNode2 == null || treeNode3 == null)
				{
					e.Effect = DragDropEffects.None;
					return;
				}
				if (treeNode2.Text != treeNode3.Text)
				{
					e.Effect = DragDropEffects.None;
					return;
				}
				if (!(treeNode.Tag is DbCategory) || !(nodeAt.Tag is Parent))
				{
					return;
				}
				try
				{
					Parent parent = (Parent)nodeAt.Tag;
					DbCategory dbCategory = (DbCategory)treeNode.Tag;
					if (!dbCategory.ParentId.Equals(parent.Guid) && MessageBox.Show(string.Concat(new string[]
					{
						"是否要将\"",
						dbCategory.Name,
						"\"分类移至\"",
						parent.Name,
						"\"？"
					}), "标准做法管理", MessageBoxButtons.OKCancel) == DialogResult.OK)
					{
						if (dbCategory.Limit)
						{
							MessageBox.Show("系统分类无法移动");
							e.Effect = DragDropEffects.None;
						}
						else if (dbCategory.ReParent(parent))
						{
							nodeAt.Nodes.Add(treeNode.Clone() as TreeNode);
							treeNode.Remove();
							nodeAt.ExpandAll();
						}
					}
					return;
				}
				catch (Exception ex)
				{
					MessageBox.Show(ex.Message);
					e.Effect = DragDropEffects.None;
					return;
				}
			}
			if (nodeAt.Tag is DbCategory)
			{
				ListViewItem listViewItem = (ListViewItem)e.Data.GetData(typeof(ListViewItem));
				Parent parent2 = (Parent)nodeAt.Tag;
				YJKDataBase.DbObject dbObject = (YJKDataBase.DbObject)listViewItem.Tag;
				if (!dbObject.Database.Equals(parent2.Database))
				{
					MessageBox.Show("只能在同一专业下修改标准间从属关系！", "标准做法管理");
					e.Effect = DragDropEffects.None;
					return;
				}
				Parent parent3;
				if (this.CurrentCategory == null)
				{
					parent3 = this.CurrentSubject;
				}
				else
				{
					parent3 = this.CurrentCategory;
				}
				try
				{
					if (!dbObject.ParentId.Equals(parent2.Guid) && MessageBox.Show(string.Concat(new string[]
					{
						"是否要将\"",
						dbObject.Name,
						"\"标准做法移至\"",
						parent2.Name,
						"\"分类？"
					}), "标准做法管理", MessageBoxButtons.OKCancel) == DialogResult.OK)
					{
						if (dbObject.Limit)
						{
							MessageBox.Show("系统族无法移动");
							e.Effect = DragDropEffects.None;
						}
						else if (dbObject.ChangeParent(parent2))
						{
							List<YJKDataBase.DbObject> allObject = parent3.GetAllObject(true);
							this.lvFamily.Items.Clear();
							this.lvFamily.LargeImageList.Images.Clear();
							this.lvFamily.SmallImageList.Images.Clear();
							this.toolStripProgressBar1.Visible = true;
							this.toolStripProgressBar1.Minimum = 0;
							this.toolStripProgressBar1.Maximum = allObject.Count;
							this.toolStripProgressBar1.Step = 1;
							this.toolStripProgressBar1.Value = 0;
							this.lvFamily.BeginUpdate();
							foreach (YJKDataBase.DbObject dbObject2 in allObject)
							{
								this.toolStripProgressBar1.PerformStep();
								this.lvFamily.LargeImageList.Images.Add(dbObject2.Name, dbObject2.Image);
								this.lvFamily.SmallImageList.Images.Add(dbObject2.Name, dbObject2.Image);
								ListViewItem listViewItem2 = new ListViewItem();
								listViewItem2.Text = dbObject2.Name;
								listViewItem2.Tag = dbObject2;
								listViewItem2.ImageKey = dbObject2.Name;
								ListViewItem.ListViewSubItem listViewSubItem = new ListViewItem.ListViewSubItem();
								listViewSubItem.Text = dbObject2.Version;
								listViewItem2.SubItems.Add(listViewSubItem);
								ListViewItem.ListViewSubItem listViewSubItem2 = new ListViewItem.ListViewSubItem();
								listViewSubItem2.Text = dbObject2.Date.ToString();
								listViewItem2.SubItems.Add(listViewSubItem2);
								ListViewItem.ListViewSubItem listViewSubItem3 = new ListViewItem.ListViewSubItem();
								listViewSubItem3.Text = parent2.Database.CategoryTable[dbObject2.ParentId].Name;
								listViewItem2.SubItems.Add(listViewSubItem3);
								ListViewItem.ListViewSubItem listViewSubItem4 = new ListViewItem.ListViewSubItem();
								listViewSubItem4.Text = dbObject2.Description.ToString();
								listViewItem2.SubItems.Add(listViewSubItem4);
								this.lvFamily.Items.Add(listViewItem2);
							}
							this.lvFamily.EndUpdate();
							this.toolStripProgressBar1.Visible = false;
						}
					}
				}
				catch (Exception ex2)
				{
					string text = ex2.Message;
					if (ex2.Message.CompareTo("Abort due to constraint violation\r\ncolumns Name, ParentId are not unique") == 0)
					{
						text = "添加失败，请检查该分类下是否包含重名族";
					}
					MessageBox.Show(text);
					e.Effect = DragDropEffects.None;
				}
			}
		}

		private void trFamilyTree_MouseClick(object sender, MouseEventArgs e)
		{
			this.trCategory.ContextMenuStrip = null;
			TreeNode nodeAt = this.trCategory.GetNodeAt(e.X, e.Y);
			if (nodeAt.Level == 0)
			{
				this.trCategory.ContextMenuStrip = this.cmsSubject;
				return;
			}
			if (nodeAt.Tag is DbCategory)
			{
				this.trCategory.ContextMenuStrip = this.cmsCategory;
			}
		}

		private void btnAddCategory_Click(object sender, EventArgs e)
		{
			this.cmdAddCategory();
		}

		private void cmdAddCategory()
		{
			if (!this.IsServer)
			{
				this.doAddCategory();
				return;
			}
			if (this.CurrentUser == null)
			{
				this.cmdLogin();
			}
			if (this.CurrentUser != null)
			{
				if (this.CurrentUser.CanAddFamily())
				{
					this.doAddCategory();
					return;
				}
				MessageBox.Show("您的账号没有添加分类的权限。");
			}
		}

		private void doAddCategory()
		{
			if (this.trCategory.SelectedNode != null)
			{
				using (DlgAddCategory instance = DlgAddCategory.GetInstance(this))
				{
					instance.Activate();
					instance.ShowDialog(this);
					return;
				}
			}
			MessageBox.Show("请选择需添加分类的上级节点");
		}

		private void btnDelCategory_Click(object sender, EventArgs e)
		{
			this.cmdDelCategory();
		}

		private void cmdDelCategory()
		{
			if (!this.IsServer)
			{
				this.doDelCategory();
				return;
			}
			if (this.CurrentUser == null)
			{
				this.cmdLogin();
			}
			if (this.CurrentUser != null)
			{
				if (this.CurrentUser.CanAddFamily())
				{
					this.doDelCategory();
					return;
				}
				MessageBox.Show("您的账号没有删除分类的权限。");
			}
		}

		private void doDelCategory()
		{
			if (this.CurrentCategory != null && MessageBox.Show("确实要把选中的分类删除？", "标准做法管理", MessageBoxButtons.OKCancel) == DialogResult.OK)
			{
				try
				{
					this.CurrentCategory.Remove();
					this.trCategory.Nodes.Remove(this.trCategory.SelectedNode);
					this.lvFamily.Items.Clear();
				}
				catch (Exception ex)
				{
					MessageBox.Show(ex.Message);
				}
			}
		}

		public TreeNode FindRoot(TreeNode node)
		{
			if (node.Parent == null)
			{
				return node;
			}
			return this.FindRoot(node.Parent);
		}

		private void btnAddFamily_Click(object sender, EventArgs e)
		{
			this.cmdAddRoom();
		}

		private void cmdAddRoom()
		{
			if (!this.IsServer)
			{
				this.doAddFamily();
				return;
			}
			if (this.CurrentUser == null)
			{
				this.cmdLogin();
			}
			if (this.CurrentUser != null)
			{
				if (this.CurrentUser.CanAddFamily())
				{
					this.doAddFamily();
					return;
				}
				MessageBox.Show("您的账号没有添加标准做法的权限。");
			}
		}

		private void doAddFamily()
		{
			if (!this.m_uiApp.ActiveUIDocument.Document.IsFamilyDocument)
			{
				using (DlgAddStandardRoom instance = DlgAddStandardRoom.GetInstance(this))
				{
					instance.Activate();
					instance.ShowDialog(this);
					return;
				}
			}
			MessageBox.Show("请在模型文档运行此命令。");
		}

		private void Recount()
		{
			if (this.CurrentCategory != null)
			{
				this.trCategory.SelectedNode.Text = this.CurrentCategory.ToString();
				this.FindRoot(this.trCategory.SelectedNode).Text = this.CurrentSubject.ToString();
				return;
			}
			this.trCategory.SelectedNode.Text = this.CurrentSubject.ToString();
		}

		private void btnEditFamilyParam_Click(object sender, EventArgs e)
		{
			new DbStandardRoom(this.currentRoom).Open(this.m_uiApp.Application);
		}

		private void cmdEditFamily()
		{
			if (!this.IsServer)
			{
				this.doEditFamily();
				return;
			}
			if (this.CurrentUser == null)
			{
				this.cmdLogin();
			}
			if (this.CurrentUser != null)
			{
				if (this.CurrentUser.CanEditFamily())
				{
					this.doEditFamily();
					return;
				}
				MessageBox.Show("您的账号没有编辑标准做法的权限。");
			}
		}

		private void doEditFamily()
		{
		}

		private void trCategory_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
		{
			TreeNode node = e.Node;
			string text = node.Text;
			Regex regex = new Regex("^[0-9a-zA-Z一-龥]+$");
			if (!text.Equals(e.Label) && e.Label != null && e.Label.Trim() != "" && regex.IsMatch(e.Label) && node.Tag is DbCategory)
			{
				DbCategory dbCategory = (DbCategory)node.Tag;
				try
				{
					if (dbCategory.ReName(e.Label))
					{
						node.Text = e.Label;
					}
					else
					{
						node.Text = text;
					}
				}
				catch (Exception ex)
				{
					MessageBox.Show(ex.Message);
				}
			}
			e.CancelEdit = true;
			this.trCategory.LabelEdit = false;
		}

		private void trFamilyTree_AfterSelect(object sender, TreeViewEventArgs e)
		{
			TreeNode node = e.Node;
			if (node.Tag != null)
			{
				if (node.Tag is DbCategory)
				{
					this.CurrentSubject = (DbSubject)this.FindRoot(node).Tag;
					this.CurrentCategory = (DbCategory)node.Tag;
					this.CurrentObject = null;
					return;
				}
				if (node.Tag is DbSubject)
				{
					this.CurrentSubject = (DbSubject)this.FindRoot(node).Tag;
					this.CurrentCategory = null;
					this.CurrentObject = null;
				}
			}
		}

		private void doAddType()
		{
			this.boAdd = true;
			this.boEdit = false;
			this.lvFamily.Enabled = false;
			this.trackBar1.Enabled = false;
			this.trCategory.Enabled = false;
			this.btnAddCategory.Enabled = false;
			this.btnDelCategory.Enabled = false;
			this.btnAddFamily.Enabled = false;
			this.btnDelFamily.Enabled = false;
			this.btnEditCategory.Enabled = false;
			this.btnEditFamily.Enabled = false;
			this.btnTop.Enabled = false;
			this.btnPrevious.Enabled = false;
			this.btnNext.Enabled = false;
			this.btnBottom.Enabled = false;
			this.cbxPageCount.Enabled = false;
			this.btnDownload.Enabled = false;
			this.tsddbSearch.Enabled = false;
			this.tsddbTools.Enabled = false;
			this.rbLocal.Enabled = false;
			this.rbUser.Enabled = false;
			this.rbServer.Enabled = false;
			base.ControlBox = false;
		}

		private void cmdAddType()
		{
			if (!this.IsServer)
			{
				this.doAddType();
				return;
			}
			if (this.CurrentUser == null)
			{
				this.cmdLogin();
			}
			if (this.CurrentUser != null)
			{
				if (this.CurrentUser.CanAddFamily())
				{
					this.doAddType();
					return;
				}
				MessageBox.Show("您的账号没有添加规格的权限。");
			}
		}

		private void btnDelFamily_Click(object sender, EventArgs e)
		{
			this.cmdDelFamily();
			this.lvFamily.Focus();
		}

		private void cmdLogin()
		{
			DlgLogin dlgLogin = new DlgLogin();
			if (dlgLogin.ShowDialog(this) == DialogResult.OK && dlgLogin.User != null)
			{
				dlgLogin.User.IncreaseCount();
				this.CurrentUser = dlgLogin.User;
				this.tsslCurrentUser.Text = "";
				this.toolStripStatusLabel2.Text = string.Format("当前登录用户：{0}", this.CurrentUser.Name);
				this.initPermission();
			}
		}

		private void cmdDelFamily()
		{
			if (!this.IsServer)
			{
				this.doRemoveFamily();
				return;
			}
			if (this.CurrentUser == null)
			{
				this.cmdLogin();
			}
			if (this.CurrentUser != null)
			{
				if (this.CurrentUser.CanDelFamily())
				{
					this.doRemoveFamily();
					return;
				}
				MessageBox.Show("您的账号没有删除的权限。");
			}
		}

		private void doRemoveFamily()
		{
			if (this.lvFamily.SelectedItems.Count > 0 && this.lvFamily.SelectedItems.Count > 0 && MessageBox.Show("确定要删除选中的标准做法？", "标准做法管理", MessageBoxButtons.OKCancel) == DialogResult.OK)
			{
				this.lvFamily.BeginUpdate();
				foreach (object obj in this.lvFamily.SelectedItems)
				{
					ListViewItem listViewItem = (ListViewItem)obj;
					try
					{
						((YJKDataBase.DbObject)listViewItem.Tag).Remove();
						listViewItem.Remove();
						this.btnDelFamily.Enabled = false;
						this.btnEditFamily.Enabled = false;
					}
					catch (Exception ex)
					{
						MessageBox.Show(ex.Message);
					}
				}
				this.lvFamily.EndUpdate();
				this.Recount();
			}
		}

		private void doEditType()
		{
			this.boAdd = false;
			this.boEdit = true;
			this.lvFamily.Enabled = false;
			this.trackBar1.Enabled = false;
			this.trCategory.Enabled = false;
			this.btnAddCategory.Enabled = false;
			this.btnDelCategory.Enabled = false;
			this.btnAddFamily.Enabled = false;
			this.btnDelFamily.Enabled = false;
			this.btnEditCategory.Enabled = false;
			this.btnEditFamily.Enabled = false;
			this.btnTop.Enabled = false;
			this.btnPrevious.Enabled = false;
			this.btnNext.Enabled = false;
			this.btnBottom.Enabled = false;
			this.cbxPageCount.Enabled = false;
			this.btnDownload.Enabled = false;
			this.tsddbSearch.Enabled = false;
			this.tsddbTools.Enabled = false;
			this.rbLocal.Enabled = false;
			this.rbUser.Enabled = false;
			this.rbServer.Enabled = false;
			base.ControlBox = false;
			foreach (object obj in this.groupBox1.Controls)
			{
				System.Windows.Forms.Control control = (System.Windows.Forms.Control)obj;
				if (control is Button)
				{
					control.Enabled = false;
				}
			}
			foreach (object obj2 in this.groupBox3.Controls)
			{
				System.Windows.Forms.Control control2 = (System.Windows.Forms.Control)obj2;
				if (control2 is Button)
				{
					control2.Enabled = false;
				}
			}
		}

		private void cmdEditType()
		{
			if (!this.IsServer)
			{
				this.doEditType();
				return;
			}
			if (this.CurrentUser == null)
			{
				this.cmdLogin();
			}
			if (this.CurrentUser != null)
			{
				if (this.CurrentUser.CanAddFamily())
				{
					this.doEditType();
					return;
				}
				MessageBox.Show("您的账号没有删除规格的权限。");
			}
		}

		private void doDelType()
		{
		}

		private void cmdDelType()
		{
			if (!this.IsServer)
			{
				this.doDelType();
				return;
			}
			if (this.CurrentUser == null)
			{
				this.cmdLogin();
			}
			if (this.CurrentUser != null)
			{
				if (this.CurrentUser.CanAddFamily())
				{
					this.doDelType();
					return;
				}
				MessageBox.Show("您的账号没有删除规格的权限。");
			}
		}

		private void cmdExport(RelationDatabase db)
		{
			SaveFileDialog saveFileDialog = new SaveFileDialog();
			saveFileDialog.FileName = this.getDbDefName(db);
			saveFileDialog.FilterIndex = 1;
			saveFileDialog.Filter = "标准间库(*.db)|*.db";
			while (saveFileDialog.ShowDialog() == DialogResult.OK)
			{
				if (saveFileDialog.FileName.IndexOf(".db") == -1)
				{
					MessageBox.Show("不是有效的标准间文件", "盈建科提示");
				}
				else
				{
					if (db.Export(saveFileDialog.FileName))
					{
						MessageBox.Show("导出成功", "标准间管理");
						return;
					}
					break;
				}
			}
		}

		private string getDbDefName(RelationDatabase db)
		{
			int num = db.Name.LastIndexOf('\\');
			return db.Name.Substring(num + 1, db.Name.Length - num - 1);
		}

		private void cmdImport()
		{
			if (!this.IsServer)
			{
				this.doImport();
				return;
			}
			if (this.CurrentUser == null)
			{
				this.cmdLogin();
			}
			if (this.CurrentUser != null)
			{
				if (this.CurrentUser.CanImport())
				{
					this.doImport();
					return;
				}
				MessageBox.Show("您的账号没有导入标准间的权限。");
			}
		}

		private void doImport()
		{
			try
			{
				OpenFileDialog openFileDialog = new OpenFileDialog();
				openFileDialog.FilterIndex = 1;
				openFileDialog.Filter = "族库(*.db)|*.db";
				if (openFileDialog.ShowDialog() == DialogResult.OK)
				{
					RelationDatabase relationDatabase = new SqliteDatabase(openFileDialog.FileName);
					RelationDatabase relationDatabase2 = null;
					foreach (RelationDatabase relationDatabase3 in this.dbs)
					{
						if (relationDatabase3.SubjectTable.AllSubject()[0].Guid == relationDatabase.SubjectTable.AllSubject()[0].Guid)
						{
							relationDatabase2 = relationDatabase3;
							break;
						}
					}
					if (relationDatabase2 == null)
					{
						MessageBox.Show("请检查导入的族库文件，是否与目标分类一致。");
					}
					else
					{
						try
						{
							string value = relationDatabase2.Name.Substring(relationDatabase2.Name.LastIndexOf(".") - 4, 4);
							if (Convert.ToInt32(openFileDialog.FileName.Substring(openFileDialog.FileName.LastIndexOf(".") - 4, 4)) > Convert.ToInt32(value))
							{
								MessageBox.Show("不能导入高版本族库。");
								return;
							}
						}
						catch (Exception)
						{
						}
						DlgCompare dlgCompare = new DlgCompare(relationDatabase2, relationDatabase);
						if (dlgCompare.ShowDialog() == DialogResult.OK)
						{
							if (relationDatabase2.Import(relationDatabase, dlgCompare.CategoryList))
							{
								MessageBox.Show("导入完成。", "族库管理");
								RelationDatabase.FillTree(this.trCategory, this.dbs);
							}
							else
							{
								MessageBox.Show("导入被取消。", "族库管理");
							}
						}
					}
				}
			}
			catch (Exception)
			{
				MessageBox.Show("请正确选择标准做法库文件。");
			}
		}

		private void cmdEditOk()
		{
		}

		private void cmdCancel()
		{
		}

		private void cmdAddOk()
		{
		}

		private void CopyToolStripMenuItem_Click(object sender, EventArgs e)
		{
		}

		private void PasteToolStripMenuItem_Click(object sender, EventArgs e)
		{
		}

		private void trFamilyTree_MouseDown(object sender, MouseEventArgs e)
		{
			if (e.Button == MouseButtons.Right)
			{
				TreeNode nodeAt = this.trCategory.GetNodeAt(e.X, e.Y);
				if (nodeAt != null)
				{
					this.trCategory.SelectedNode = nodeAt;
				}
			}
		}

		private void ReNameToolStripMenuItem_Click(object sender, EventArgs e)
		{
			if (this.CurrentCategory.Limit)
			{
				MessageBox.Show("系统分类无法重命名", "标准间管理");
				return;
			}
			this.trCategory.LabelEdit = true;
			this.trCategory.SelectedNode.BeginEdit();
		}

		private void trackBar1_Scroll(object sender, EventArgs e)
		{
			switch (this.trackBar1.Value)
			{
			case 0:
            this.lvFamily.View = System.Windows.Forms.View.Details;
				this.lvFamily.FullRowSelect = true;
				break;
			case 1:
                this.lvFamily.View = System.Windows.Forms.View.List;
				break;
			case 2:
                this.lvFamily.View = System.Windows.Forms.View.LargeIcon;
				break;
			}
			this.lvFamily.Select();
			this.lvFamily.Focus();
		}

		private void listView1_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (this.lvFamily.SelectedItems.Count == 1)
			{
				this.CurrentObject = (YJKDataBase.DbObject)this.lvFamily.SelectedItems[0].Tag;
			}
		}

		public void ShowType()
		{
		}

		private void listView1_AfterLabelEdit(object sender, LabelEditEventArgs e)
		{
			string text = this.lvFamily.Items[e.Item].Text;
			if (this.lvFamily.Items[e.Item].Tag is YJKDataBase.DbObject && e.Label != null && e.Label != "" && !text.Equals(e.Label))
			{
				if (((YJKDataBase.DbObject)this.lvFamily.Items[e.Item].Tag).Rename(e.Label))
				{
					this.lvFamily.Items[e.Item].Text = e.Label;
				}
				else
				{
					this.lvFamily.Items[e.Item].Text = text;
				}
			}
			e.CancelEdit = true;
			this.lvFamily.LabelEdit = false;
		}

		private void inputToolStripMenuItem_Click(object sender, EventArgs e)
		{
			this.cmdImport();
		}

		private void outputToolStripMenuItem_Click(object sender, EventArgs e)
		{
			this.cmdExport();
		}

		private void groupBox3_Enter(object sender, EventArgs e)
		{
		}

		private void statusStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
		{
		}

		private void AddTypeToolStripMenuItem1_Click(object sender, EventArgs e)
		{
			this.cmdAddType();
		}

		private void RemoveTypeToolStripMenuItem_Click(object sender, EventArgs e)
		{
			this.cmdDelType();
		}

		private void EditTypeToolStripMenuItem_Click(object sender, EventArgs e)
		{
			this.cmdEditType();
		}

		private void addCategoryToolStripMenuItem1_Click(object sender, EventArgs e)
		{
			this.cmdAddCategory();
		}

		private void removeToolStripMenuItem_Click(object sender, EventArgs e)
		{
			this.cmdDelCategory();
		}

		private void AddFamilyToolStripMenuItem_Click(object sender, EventArgs e)
		{
			this.cmdAddRoom();
		}

		private void 删除ToolStripMenuItem_Click(object sender, EventArgs e)
		{
			this.cmdDelFamily();
		}

		private void 编辑ToolStripMenuItem_Click(object sender, EventArgs e)
		{
			this.cmdEditFamily();
		}

		private void addFamilyToolStripMenuItem1_Click(object sender, EventArgs e)
		{
			this.cmdAddRoom();
		}

		private void 添加分类ToolStripMenuItem_Click(object sender, EventArgs e)
		{
			this.doAddCategory();
		}

		private void 重命名ToolStripMenuItem_Click(object sender, EventArgs e)
		{
			if (this.lvFamily.SelectedItems.Count > 0)
			{
				if (this.CurrentObject.Limit)
				{
					MessageBox.Show("系统标准间无法重命名", "标准间管理");
					return;
				}
				this.lvFamily.LabelEdit = true;
				this.lvFamily.SelectedItems[0].BeginEdit();
			}
		}

		private void btnEditCategoryParam_Click(object sender, EventArgs e)
		{
			this.cmdEditCategory();
		}

		private void cmdEditCategory()
		{
			if (!this.IsServer)
			{
				this.doEditCategory();
				return;
			}
			if (this.CurrentUser == null)
			{
				this.cmdLogin();
			}
			if (this.CurrentUser != null)
			{
				if (this.CurrentUser.CanAddFamily())
				{
					this.doEditCategory();
					return;
				}
				MessageBox.Show("您的账号没有编辑分类的权限。");
			}
		}

		private void doEditCategory()
		{
			using (DlgEditCategory instance = DlgEditCategory.GetInstance(this))
			{
				instance.Activate();
				instance.ShowDialog(this);
			}
		}

		private void editCategoryToolStripMenuItem1_Click(object sender, EventArgs e)
		{
			this.cmdEditCategory();
		}

		private void 导出ToolStripMenuItem_Click(object sender, EventArgs e)
		{
			this.cmdExport();
		}

		private void cmdExport()
		{
			if (!this.IsServer)
			{
				this.doExport();
				return;
			}
			if (this.CurrentUser == null)
			{
				this.cmdLogin();
			}
			if (this.CurrentUser != null)
			{
				if (this.CurrentUser.CanExport())
				{
					this.doExport();
					return;
				}
				MessageBox.Show("您的账号没有导出标准间的权限。");
			}
		}

		private void doExport()
		{
			if (this.trCategory.SelectedNode == null)
			{
				MessageBox.Show("请选中要导出的专业", "标准间管理");
				return;
			}
			this.cmdExport(this.CurrentSubject.Database);
		}

		private void 导入ToolStripMenuItem_Click(object sender, EventArgs e)
		{
			this.cmdImport();
		}

		private void cbxPageCount_SelectedIndexChanged(object sender, EventArgs e)
		{
			try
			{
				this.btnTop.Enabled = true;
				this.btnPrevious.Enabled = true;
				this.btnNext.Enabled = true;
				this.btnBottom.Enabled = true;
				if (this.cbxPageCount.SelectedIndex == 0)
				{
					this.btnTop.Enabled = false;
					this.btnPrevious.Enabled = false;
				}
				else
				{
					this.btnTop.Enabled = true;
					this.btnPrevious.Enabled = true;
				}
				if (this.cbxPageCount.SelectedIndex == this.cbxPageCount.Items.Count - 1)
				{
					this.btnNext.Enabled = false;
					this.btnBottom.Enabled = false;
				}
				else
				{
					this.btnNext.Enabled = true;
					this.btnBottom.Enabled = true;
				}
				this.lvFamily.Items.Clear();
				this.lvFamily.LargeImageList.Images.Clear();
				this.lvFamily.SmallImageList.Images.Clear();
				Convert.ToInt32(this.cbxPageCount.SelectedItem);
				List<YJKDataBase.DbObject> list = new List<YJKDataBase.DbObject>();
				this.lvFamily.BeginUpdate();
				foreach (YJKDataBase.DbObject dbObject in list)
				{
					this.lvFamily.LargeImageList.Images.Add(dbObject.Name, dbObject.Image);
					this.lvFamily.SmallImageList.Images.Add(dbObject.Name, dbObject.Image);
					ListViewItem listViewItem = new ListViewItem();
					listViewItem.Text = dbObject.Name;
					listViewItem.Tag = dbObject;
					listViewItem.ImageKey = dbObject.Name;
					ListViewItem.ListViewSubItem listViewSubItem = new ListViewItem.ListViewSubItem();
					listViewSubItem.Text = dbObject.Version;
					listViewItem.SubItems.Add(listViewSubItem);
					ListViewItem.ListViewSubItem listViewSubItem2 = new ListViewItem.ListViewSubItem();
					listViewSubItem2.Text = dbObject.Date.ToString();
					listViewItem.SubItems.Add(listViewSubItem2);
					ListViewItem.ListViewSubItem listViewSubItem3 = new ListViewItem.ListViewSubItem();
					listViewSubItem3.Text = this.searchDb.CategoryTable[dbObject.ParentId].Name;
					listViewItem.SubItems.Add(listViewSubItem3);
					ListViewItem.ListViewSubItem listViewSubItem4 = new ListViewItem.ListViewSubItem();
					listViewSubItem4.Text = dbObject.Description;
					listViewItem.SubItems.Add(listViewSubItem4);
					this.lvFamily.Items.Add(listViewItem);
				}
				this.lvFamily.EndUpdate();
				this.lvFamily.Focus();
			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
		}

		private void button3_Click(object sender, EventArgs e)
		{
			if (this.cbxPageCount.SelectedIndex != 0)
			{
				System.Windows.Forms.ComboBox comboBox = this.cbxPageCount;
				int selectedIndex = comboBox.SelectedIndex;
				comboBox.SelectedIndex = selectedIndex - 1;
			}
			this.lvFamily.Focus();
		}

		private void button4_Click(object sender, EventArgs e)
		{
			if (this.cbxPageCount.SelectedIndex < this.cbxPageCount.Items.Count - 1)
			{
				System.Windows.Forms.ComboBox comboBox = this.cbxPageCount;
				int selectedIndex = comboBox.SelectedIndex;
				comboBox.SelectedIndex = selectedIndex + 1;
			}
			this.lvFamily.Focus();
		}

		private void button2_Click(object sender, EventArgs e)
		{
			this.cbxPageCount.SelectedIndex = 0;
			this.lvFamily.Focus();
		}

		private void button5_Click(object sender, EventArgs e)
		{
			this.cbxPageCount.SelectedIndex = this.cbxPageCount.Items.Count - 1;
			this.lvFamily.Focus();
		}

		private void 加载ToolStripMenuItem_Click(object sender, EventArgs e)
		{
		}

		private void tsmiUserPath_Click(object sender, EventArgs e)
		{
		}

		private void tsmiServer_Click(object sender, EventArgs e)
		{
		}

		private void rbLocal_CheckedChanged(object sender, EventArgs e)
		{
			if (this.rbLocal.Checked)
			{
				try
				{
					this.dbs.Clear();
					this.dbs.Add(RelationDatabase.GetSqliteDB(string.Format("StandardRoom{0}.db", this.m_uiApp.Application.VersionNumber), this.m_uiApp.Application.VersionNumber));
					if (this.dbs.Count < 1)
					{
						MessageBox.Show("\n没有检测到本地标准间库，请安装标准间数据库。");
						this.rbLocal.Checked = false;
						base.Close();
					}
					RelationDatabase.FillTree(this.trCategory, this.dbs);
					this.lvFamily.Items.Clear();
					this.IsServer = false;
					this.btnDownload.Visible = false;
					this.tsddbLogin.Enabled = false;
					this.tsddbCommunication.Visible = false;
					this.rbTemp = this.rbLocal;
					this.CurrentCategory = null;
					this.CurrentSubject = null;
					this.currentRoom = null;
					this.timer1.Enabled = false;
					LocalDbData data = new LocalDbData("");
					ConfigUtils.WriteStandardRoomXmlFile(ConfigUtils.GetStandardRoomConfigFileName(), data);
					return;
				}
				catch (Exception ex)
				{
					MessageBox.Show(ex.Message);
					if (this.rbTemp != null)
					{
						this.rbTemp.Checked = true;
					}
					return;
				}
			}
			this.rbTemp = this.rbLocal;
		}

		private void rbUser_CheckedChanged(object sender, EventArgs e)
		{
		}

		private void rbServer_CheckedChanged(object sender, EventArgs e)
		{
			if (this.rbServer.Checked)
			{
				try
				{
					this.dbs.Clear();
					string fileName = AssistFunc.GetAppRootPath() + "\\Data\\Config.xml";
					string dataFromConfigFile = XmlUtils.GetDataFromConfigFile(fileName, "Server", "value");
					if (dataFromConfigFile == "")
					{
						MessageBox.Show("请先运行‘服务器连接配置’命令配置服务器");
						this.rbTemp.Checked = true;
					}
					else
					{
						ServerDbData data = new ServerDbData("", "", "");
						ConfigUtils.WriteStandardRoomXmlFile(ConfigUtils.GetStandardRoomConfigFileName(), data);
						RelationDatabase mySqlDb = RelationDatabase.GetMySqlDb(new ConnectData(dataFromConfigFile, XmlUtils.GetDataFromConfigFile(fileName, "Uid", "value"), XmlUtils.GetDataFromConfigFile(fileName, "Pwd", "value")), string.Format("StandardRoom{0}", this.m_uiApp.Application.VersionNumber));
						this.dbs.Add(mySqlDb);
						if (this.dbs.Count < 1)
						{
							MessageBox.Show("\n标准间服务器没有正确配置数据库，请联系数据库管理员。");
							this.rbLocal.Checked = true;
						}
						else
						{
							RelationDatabase.FillTree(this.trCategory, this.dbs);
							this.lvFamily.Items.Clear();
							this.IsServer = true;
							this.tsddbLogin.Enabled = true;
							this.autoLogin();
							this.rbTemp = this.rbServer;
							this.CurrentCategory = null;
							this.CurrentSubject = null;
							this.currentRoom = null;
							this.timer1.Enabled = true;
						}
					}
				}
				catch (Exception ex)
				{
					MessageBox.Show(ex.Message);
					if (this.rbTemp != null)
					{
						this.rbTemp.Checked = true;
					}
				}
			}
		}

		private void autoLogin()
		{
			string fileName = AssistFunc.GetAppRootPath() + "\\Data\\Config.xml";
			DbUser user = DbUser.GetUser(XmlUtils.GetDataFromConfigFile(fileName, "AutoUser", "value"), BimServerDB.Default);
			if (user == null)
			{
				return;
			}
			string dataFromConfigFile = XmlUtils.GetDataFromConfigFile(fileName, "AutoPwd", "value");
			if (!user.Password.Equals(DbUser.ToMd5(dataFromConfigFile)))
			{
				return;
			}
			this.CurrentUser = user;
			user.IncreaseCount();
			this.tsslCurrentUser.Text = "";
			this.toolStripStatusLabel2.Text = string.Format("当前登录用户：{0}", this.CurrentUser.Name);
			this.initPermission();
		}

		private void CreateCategoryByFolder(DbCategory category, DirectoryInfo rootDir)
		{
		}

		private void 导入族文件夹ToolStripMenuItem_Click(object sender, EventArgs e)
		{
			if (!this.IsServer)
			{
				this.cmdImportFolder();
				return;
			}
			if (this.CurrentUser == null)
			{
				DlgLogin dlgLogin = new DlgLogin();
				if (dlgLogin.ShowDialog(this) == DialogResult.OK && dlgLogin.User != null)
				{
					if (dlgLogin.User.Status == UserStatus.Unregistered)
					{
						MessageBox.Show("您的账号未通过验证，请联系系统管理员。");
						return;
					}
					dlgLogin.User.IncreaseCount();
					this.CurrentUser = dlgLogin.User;
					this.cmdImportFolder();
					return;
				}
			}
			else
			{
				this.cmdImportFolder();
			}
		}

		private void cmdImportFolder()
		{
			FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
			if (this.defaultfilePath != "")
			{
				folderBrowserDialog.SelectedPath = this.defaultfilePath;
			}
			if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
			{
				this.defaultfilePath = folderBrowserDialog.SelectedPath;
				DirectoryInfo rootDir = new DirectoryInfo(folderBrowserDialog.SelectedPath);
				this.CreateCategoryByFolder(this.CurrentCategory, rootDir);
				MessageBox.Show("添加完成。", "标准间管理");
				RelationDatabase.FillTree(this.trCategory, this.dbs);
			}
		}

		private void toolStripDropDownButton1_Click(object sender, EventArgs e)
		{
		}

		private void tsmiLogin_Click(object sender, EventArgs e)
		{
		}

		private void cmdLogout()
		{
			this.CurrentUser = null;
			this.toolStripStatusLabel2.Text = "服务器管理账户当前未登录";
			this.tsddbCommunication.Enabled = false;
			this.tsmChangePass.Visible = false;
			MessageBox.Show("成功注销。");
		}

		private void tsmiLogout_Click(object sender, EventArgs e)
		{
		}

		private void tsmiRegiste_Click(object sender, EventArgs e)
		{
		}

		private void tsmiChangePW_Click(object sender, EventArgs e)
		{
		}

		private void 加载ToolStripMenuItem1_Click(object sender, EventArgs e)
		{
		}

		private void 登陆ToolStripMenuItem_Click(object sender, EventArgs e)
		{
			if (this.CurrentUser != null)
			{
				if (MessageBox.Show("当前已登录的账户：" + this.CurrentUser.Name + "，是否注销并更改用户登录？", "注销", MessageBoxButtons.YesNo) == DialogResult.Yes)
				{
					this.cmdLogout();
					this.cmdLogin();
					return;
				}
			}
			else
			{
				this.cmdLogin();
			}
		}

		private void 注册ToolStripMenuItem_Click(object sender, EventArgs e)
		{
			new DlgRegistrate(this.mGroup).ShowDialog(this);
		}

		private void 注销ToolStripMenuItem_Click(object sender, EventArgs e)
		{
			this.cmdLogout();
		}

		private void 修改密码ToolStripMenuItem_Click(object sender, EventArgs e)
		{
			new DlgChangePassword(this.CurrentUser.Name).ShowDialog(this);
		}

		private void tsddbLogin_Click(object sender, EventArgs e)
		{
		}

		private void btnDownload_Click(object sender, EventArgs e)
		{
			this.cmdDownload();
		}

		private void cmdDownload()
		{
			if (!this.IsServer)
			{
				this.doDownload();
				return;
			}
			if (this.CurrentUser == null)
			{
				this.cmdLogin();
			}
			if (this.CurrentUser != null)
			{
				if (this.CurrentUser.CanExport())
				{
					this.doDownload();
					return;
				}
				MessageBox.Show("您的账号没有下载标准间的权限。");
			}
		}

		private void doDownload()
		{
		}

		private void 升级ToolStripMenuItem_Click(object sender, EventArgs e)
		{
		}

		private void 按族名查询ToolStripMenuItem_Click(object sender, EventArgs e)
		{
		}

		private void 按日期查询ToolStripMenuItem_Click(object sender, EventArgs e)
		{
		}

		private void timer1_Tick(object sender, EventArgs e)
		{
			try
			{
				if (this.CurrentUser != null)
				{
					if (this.CurrentUser.NewMessageCount > 0)
					{
						this.tsddbCommunication.Text = "通讯(" + this.CurrentUser.NewMessageCount + ")";
						this.tsmiInbox.Text = "收件箱(" + this.CurrentUser.NewMessageCount + ")";
					}
					else
					{
						this.tsddbCommunication.Text = "通讯";
						this.tsmiInbox.Text = "收件箱";
					}
					this.initPermission();
				}
			}
			catch (Exception)
			{
			}
		}

		private void initPermission()
		{
			this.tsddbCommunication.Visible = false;
			this.tsmChangePass.Visible = true;
			this.tsddbCommunication.Visible = true;
			this.tsddbCommunication.Enabled = true;
		}

		private void toolStripMenuItem4_Click(object sender, EventArgs e)
		{
			new DlgSendMessage(this.CurrentUser).ShowDialog(this);
		}

		private void 收件箱ToolStripMenuItem_Click(object sender, EventArgs e)
		{
			new DlgMessageBox(this.CurrentUser).ShowDialog(this);
		}

		private void splitContainer1_Panel1_Paint(object sender, PaintEventArgs e)
		{
		}

		private void 添加参数ToolStripMenuItem_Click(object sender, EventArgs e)
		{
		}

		private void groupBox1_Enter(object sender, EventArgs e)
		{
		}

		private static DlgMain main;

		private string mGroup = "FM";

		private UIApplication m_uiApp;

		public List<RelationDatabase> dbs = new List<RelationDatabase>();

		public DbSubject currentSubject;

		public DbCategory currentCategory;

		public YJKDataBase.DbObject currentRoom;

		private bool boEdit;

		private bool boAdd;

		public string initialDirectory = "C:\\";

		public static int pageContainment = 24;

		private RelationDatabase searchDb;

		private string ip;

		private string uName;

		private string pw;

		private bool flag;

		private RadioButton rbTemp;

		private bool IsServer;

		private DbUser CurrentUser;

		private string defaultfilePath = "";

		public class ListViewColumnSorter : IComparer
		{
			public ListViewColumnSorter()
			{
				this.ColumnToSort = 0;
				this.OrderOfSort = SortOrder.None;
				this.ObjectCompare = new CaseInsensitiveComparer();
			}

			public int Compare(object x, object y)
			{
				return 0;
			}

			public int ColumnToSort;

			public SortOrder OrderOfSort;

			private CaseInsensitiveComparer ObjectCompare;
		}
	}
}
